package org.vergil.core.thread.testForVolatile;

/**
 * Created by vergil on 17-3-14.
 */
public class Test implements Runnable {
    private volatile String name;


    @Override
    public void run() {
        while (true) {
            this.name = Thread.currentThread().getName();
            System.out.println(Thread.currentThread().getName()+ ":" +name);
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
